<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<a4j:commandButton id="insertSaleLine" onclick="#{rich:component('insertReserveLineSalePanel')}.show()" image="/images/addRow.png" actionListener="#{con100.insertReserveLineSaleOpen}" disabled="#{!con100.editSale}"/>
<rich:scrollableDataTable var="saleItem" value="#{con100.saleItems}" width="800px" height="110px" id="reserveItemSaleTable" selection="#{con100.selectionSale}">
	<rich:column sortable="false" width="80px">
		<f:facet name="header">
			<h:outputText value="Sale Order"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.id.saleOrder}"></h:outputText>
	</rich:column>
	<rich:column sortable="false" width="50px">
		<f:facet name="header">
			<h:outputText value="Sale Item"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.id.saleItem}"></h:outputText>
	</rich:column>	
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.material}"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.saleData.material}"></h:outputText>
	</rich:column>		
	<rich:column sortable="false" styleClass="textRight">
		<f:facet name="header">
			<h:outputText value="#{bundle.qty_order}"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.saleData.quantity}">
			<f:convertNumber pattern="#,##0.00"/>
		</h:outputText>
	</rich:column>
	<rich:column sortable="false" width="40px">
		<f:facet name="header">
			<h:outputText value="#{bundle.uom}"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.saleData.uom}"></h:outputText>
	</rich:column>	
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="Due Date"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.saleData.dueDate}">
			<f:convertDateTime pattern="dd.MM.yyyy" locale="th_US"/>
		</h:outputText>
	</rich:column>	
	<rich:column sortable="false" width="110px">
		<f:facet name="header">
			<h:outputText value="Production greige"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.commonDataId.productionNo}" id="saleProduct"/>
	</rich:column>	
	<rich:column sortable="false">
		<f:facet name="header">
			<h:outputText value="#{bundle.remark}"></h:outputText>
		</f:facet>
		<h:outputText value="#{saleItem.reserveItemSale.remark}"/>
	</rich:column>
	<rich:column sortable="false" width="40px" styleClass="textCenter">
		<f:facet name="header">
			<h:outputText value="Actions"></h:outputText>
		</f:facet>
		<a4j:commandLink id="editLineSaleLink" reRender="editReserveLineSalePanel" oncomplete="#{rich:component('editReserveLineSalePanel')}.show()" ajaxSingle="true">
			<h:graphicImage value="/images/icon_edit_item.gif" style="border:0" />
		</a4j:commandLink>
	</rich:column>
	<a4j:support id="take_reservelineSale" event="onselectionchange" actionListener="#{con100.onchangeReserveLineSale}"/>
</rich:scrollableDataTable>

